﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>" />    
    <title>博洛尼核算系统</title>
    <style type="text/css">
    	html,body {
    		font-family: Arial, Helvetica, sans-serif; 
    		font-size:12px; 
    		margin:0px;
    		padding:0px;   
    		background:#267CBA url('images/loginbg.png') no-repeat; 		
    	}    	
    	.container {
    		position: absolute;
		  	width:700px;
		  	height:400px;
		  	left:160px;
		  	top:150px;		  	
		 	border:0px solid red;	  	    		
    	}    	
    </style>
    <script language="javascript" src="<%=request.getContextPath() %>/js/ajaxobj.js" ></script>
    <script type="text/javascript" language="javascript">
    	function checkLogin(){
			var data="";
			var returnInfo="";			
			var loginname = document.getElementById("loginname");
			var loginpass = document.getElementById("loginpass");
			var authCode=document.getElementById("authCode")			
			var _returnInfo = document.getElementById("returnInfo");
			
			if(loginpass.value=="" && loginpass.value==""){
				_returnInfo.innerHTML="用户密码未填写!"
				return false;
			}
			if(authCode.value==""){
				_returnInfo.innerHTML="请输入验证码!"
				return false;
			}
			
			
			data+="loginname="+loginname.value;
			data+="&loginpass="+loginpass.value;
			data+="&authCode="+authCode.value
			var url="<%=request.getContextPath()%>/login!login.shtml";
			doActon("POST",url,doLoginReturn,data);	
						
		}
		function doLoginReturn(responseText){
			var loginForm = eval('(' + responseText + ')');
			var _returnInfo = document.getElementById("returnInfo");					
			if(loginForm.model.returnCode==0){
				_returnInfo.innerHTML=loginForm.model.returnInfo;
				changeAuthImg();
			}else if(loginForm.model.returnCode==1){
				document.loginForm.submit();
			}
		}
		function changeAuthImg(){
				var authImg=document.getElementById("authImg")
				authImg.src=authImg.src+"?requestFlag="+new Date().getTime();
		}
		function onKeyInput2(e) {
			if (event.keyCode == 13) {
				checkLogin();
			}
		}
  		function reindex(){  		
	  		if(window.parent.length>0){
				window.parent.location="<%=basePath%>/index.jsp";     
	  		}   
		}
		function focusTxt(type){
			if(type==1){
				document.getElementById("loginname").focus(); 
			}else if(type==2){
				document.getElementById("loginpass").focus();
			}else if(type==3){
				document.getElementById("authCode").focus();
			}
		}
    </script>
  </head>
  
  <body onload="reindex();" style="">
  	<form action="logined!logined.shtml" method="post" name="loginForm" id="loginForm">
    <div class="container">
    	<ul style="list-style:none;margin:90px 40px 0 30px;padding:0;width:205px;height:180px;border:0px solid red;float:left;color:#fff;">
    		<li style="height:33px;line-height:30px;border:0px solid yellow;display:block;cursor:hand;">用&nbsp;&nbsp;&nbsp;&nbsp;户：<input type="text" name="loginname" id="loginname" style="width:150px;border:none;border-bottom:1px solid #CAE6F6;font-size:12px;background:url('images/loginone.jpg') repeat-x fixed 0px 0px;height:16px;" onkeypress="onKeyInput2(event)" /></li>
    		<li style="height:33px;line-height:30px;border:0px solid yellow;">密&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="password" name="loginpass" id="loginpass" style="width:150px;border:none;border-bottom:1px solid #CAE6F6;font-size:12px;background:url('images/logintwo.jpg') no-repeat fixed 0px 0px;height:16px;" onkeypress="onKeyInput2(event)"  /></li>
    		<li style="height:62px;line-height:30px;border:0px solid yellow;">验证码：<input type="text" name="authCode" id="authCode" style="font-size:12px;width:58px;border:none;border-bottom:1px solid #CAE6F6;background:url('images/loginthree.jpg') no-repeat fixed 0px 0px;height:16px;" maxlength="4" onkeypress="onKeyInput2(event)"  /><img title="换一张" align="top" onclick="changeAuthImg();" style="margin-left:10px;cursor:hand;" src="<%=request.getContextPath() %>/AuthImgAction.shtml" id="authImg" width="82" height="22" /></li>
    		<li style="height:31px;line-height:30px;border:0px solid yellow;"><label id="returnInfo" style="color:#E8641B;font-size:12px;margin:65px 0 0 10px;">&nbsp;</label></li>
    		<li style="height:20px;line-height:20px;border:0px solid yellow;"><input type="button" style="margin-left:20px;width:156px;height:23px;border:none;background:url('images/loginbtn.png') no-repeat;cursor:hand;" onclick="checkLogin();" /></li>    		
    	</ul>    	
    	<br style="clear:both;" />
    	<br style="clear:both;" />
    	<br style="clear:both;" />
    	<div style="border:0px solid red;height:36px;line-height:36px;padding-left:50px;text-align:center;margin:30px 0 0 0;color:#003567;font-size:13px;">博洛尼装饰公司</div>
    </div>
    </form>
  </body>
</html>
